<template>
  <div>
    <el-table :data="rootList" border style="width: 100%">
      <el-table-column prop="id" label=" " width="180"> </el-table-column>
      <el-table-column prop="authName" label="权限名称" width="180">
      </el-table-column>
      <el-table-column prop="path" label="路径" width="180"> </el-table-column>
      <el-table-column prop="level" label="权限等级">
        <template slot-scope="scope">
          <el-tag type="success" v-if="scope.row.level === `0`">{{
            "等级" + (Number(scope.row.level) + 1)
          }}</el-tag>
          <el-tag type="danger" v-if="scope.row.level === `1`">{{
            "等级" + (Number(scope.row.level) + 1)
          }}</el-tag>
          <el-tag type="warning" v-if="scope.row.level === `2`">{{
            "等级" + (Number(scope.row.level) + 1)
          }}</el-tag>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      rootList: [],
    };
  },
  mounted() {
    this.gteRootList();
  },
  methods: {
    gteRootList() {
      this.$req.get(`/rights/list`).then((res) => {
        this.rootList = res.data.data;
        console.log(this.rootList);
      });
    },
  },
};
</script>

<style>
.has-gutter {
  line-height: 0;
}
</style>